<%@tag description="Main Template" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@attribute name="styles" fragment="true" %>
<%@attribute name="scripts" fragment="true" %>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@attribute name="pageTitle"  %>
<%@attribute name="adminSection"  %>

<c:set var="applicationPath" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html>
<html lang="pt">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <c:if test="${empty pageTitle}">
        <c:set var="pageTitle" value="Admin" />
    </c:if>
    <title>Bagarita | ${pageTitle}</title>

    <!-- Bootstrap -->
    <link href="${applicationPath}/static/css/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="${applicationPath}/static/css/lib/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="${applicationPath}/static/css/admin.css" rel="stylesheet">

    <jsp:invoke fragment="styles" />
    
    <!-- jQuery -->
    <script src="${applicationPath}/static/js/lib/jquery/jquery-1.11.1.min.js" ></script>
    <!-- Bootstrap script -->
    <script src="${applicationPath}/static/js/lib/bootstrap.min.js" ></script>
  </head>
  <body>

    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">${pageTitle}</a>
        </div>
        <!-- <div class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
          </ul>
        </div> --><!--/.nav-collapse -->
      </div>
    </div>
    <div class="container">
        <div class="row">
            <p>&nbsp;</p>
        </div>
        <div class="row">
            <c:if test="${empty adminSection}">
                <c:set var="adminSection" value="content" />
            </c:if>
            <ul class="nav nav-tabs" role="tablist">
                <%--TODO fazer verificação de permissões do usuário --%>
                <li class="${ adminSection eq 'dashboard' ? 'active' : '' }"><a href="#"><spring:message code="admin.label.dashboard" /></a></li>
                <li class="${ adminSection eq 'content' ? 'active' : '' }"><a href="#"><spring:message code="admin.label.content" /></a></li>
                <li class="${ adminSection eq 'auth' ? 'active' : '' }"><a href="#"><spring:message code="admin.label.auth" /></a></li>
            </ul>
        </div>
        <div class="row">
            <div class="container">
                <jsp:doBody/>
            </div>
        </div>
    </div>

    <jsp:invoke fragment="scripts" />
  </body>
</html>
